import request from '@/utils/request';

/**
 * 版本更新日志
 */
export async function versionList(data) {
  const res = await request.post('/Version/versionList', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 请求授权
 */
export async function pirate(data) {
  const res = await request.post('/version/pirate', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 更新
export async function index(data) {
  const res = await request.post('/Version/index', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

//
export async function isNew(data) {
  const res = await request.post('/Version/isNew', data);
  if (res.data.code === 0) {
    return res.data;
  } else {
    return res.data;
  }
  //   return Promise.reject(new Error(res.data.message));
}
// 安装
export async function install(data) {
  const res = await request.post('/install/index', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
//下载小程序
export async function getH5Zip(data) {
  const res = await request.post('/version/getH5Zip', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
